﻿Public Class FormFactoryOutsourceSave
    Dim oper_u As String
    Public sys_id As String
    Public assist_marker As String
    Dim objFactory0utsourceMst As New clsFactory0utsourceMst
    Dim objGt As New clsGt

    Private Sub FormFactoryOutsourceSave_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        oper_u = GetIniFile("LOGIN", "user", "", g_szInitFileName)
        Dim dt As DataTable = objFactory0utsourceMst.getList("1", "jnj")
        dgv.AutoGenerateColumns = False
        dgv.DataSource = dt
    End Sub

    Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
        If String.IsNullOrEmpty(oper_u) Then
            MsgBox("请切换用户进行登录！")
            Exit Sub
        End If
        If dgv.SelectedRows.Count > 0 Then
            If String.IsNullOrEmpty(assist_marker) Then
                Dim rtn As Integer = objGt.update_assist_marker(sys_id, dgv.SelectedRows(0).Cells("Col_name").Value.ToString())
                If rtn <> -2 Then
                    MsgBox("保存成功")
                    CType(Owner, FormCheck).setDgvData()
                    Close()
                Else
                    MsgBox("保存失败")
                End If
            Else
                If MsgBox("确认要更换胶黏剂厂商吗？", vbYesNo, "提示") = vbYes Then
                    Dim rtn As Integer = objGt.update_assist_marker(sys_id, dgv.SelectedRows(0).Cells("Col_name").Value.ToString())
                    If rtn <> -2 Then
                        MsgBox("保存成功")
                        CType(Owner, FormCheck).setDgvData()
                        Close()
                    Else
                        MsgBox("保存失败")
                    End If
                End If
            End If
        End If
    End Sub

End Class